package com.huawei.service.impl;

import com.huawei.dao.DingdanMapper;
import com.huawei.dao.UserMapper;
import com.huawei.dao.User_siteMapper;
import com.huawei.entity.Dingdan;
import com.huawei.entity.Jinebiandong;
import com.huawei.service.DingdanService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;
import java.util.Map;

/**
 * @ClassName DingdanImpl
 * @Description TODO
 * @Author 马效鹏
 * @Date 2021/11/29 17:47
 */

    @Service

public class DingdanImpl implements DingdanService {
    @Resource
    DingdanMapper dingdanMapper;
    @Resource
    UserMapper userMapper;
    @Resource
    User_siteMapper user_siteMapper;
    @Override
    public List<Dingdan> selectAll(Map<String, Object> pars) {
        List<Dingdan> list=dingdanMapper.selectAll(pars);
        for(Dingdan n:list){
           n.setUser2(userMapper.getId(n.getUser_id()));
        }
        for(Dingdan a:list){
            a.setUser_site2(user_siteMapper.getId(a.getUser_id()));
        }
        return list;
    }

    @Override
    public int count(Map<String, Object> pars) {
        return dingdanMapper.count(pars);
    }

    @Override
    public int add(Dingdan dingdan) {

            return dingdanMapper.add(dingdan);

    }

    @Override
    public int update(Dingdan dingdan) {

            return dingdanMapper.update(dingdan);

    }

    @Override
    public int delete(int dingdan_id) {
        return dingdanMapper.delete(dingdan_id);
    }

    @Override
    public Dingdan getId(int dingdan_id) {
        return dingdanMapper.getId(dingdan_id);
    }

    @Override
    public int status(int dingdan_id, String shangpin_status) {
        return dingdanMapper.status(dingdan_id,shangpin_status);
    }


}
